// Time:  O(nlogn)
// Space: O(1)

// sort
class Solution {
public:
    vector<vector<int>> sortThreats(vector<vector<int>>& threats) {
        sort(begin(threats), end(threats), [](const auto& a, const auto& b) {
            return pair(-(2ll * a[1] + a[2]), a[0]) < pair(-(2ll * b[1] + b[2]), b[0]);
        });
        return threats;
    }
};
